package com.ruoyi.user.model.enums;


import com.ruoyi.common.core.constant.constant.CodeConstant;
import com.ruoyi.common.core.enums.BaseEnum;

public enum UserResultEnum implements BaseEnum {
    ERROR(CodeConstant.ERROR,"服务器错误,请联系管理员!"),
    BALANCE_FAIL(CodeConstant.ERROR,"余额不足!"),
    ;

    UserResultEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    String code;
    String message;

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public void setMessage(String message) {
        this.message = message;
    }

    public static UserResultEnum messageResultEnum(String message)
    {
        for (UserResultEnum value : UserResultEnum.values()) {
            if (value.getMessage().equals(message)) {
                return value;
            }
        }
        return UserResultEnum.ERROR;
    }
}
